curl -X GET http://localhost:8080/starbucks/tb1-store/list?id=110523 | json

# buy a coffee
curl -X POST http://localhost:8080/starbucks/buy?trace=on \
-H "Content-Type: application/json" \
-d '{"longitude":"114.086697","latitude":"22.554429","buyTime":"2021-04-27 02:22:56"}' | json

curl -X POST http://localhost:8080/starbucks/buy?trace=off \
-H "Content-Type: application/json" \
-d '{"longitude":"114.086697","latitude":"22.554429","buyTime":"2021-04-27 02:22:56"}' | json

curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-16 00:00:00",
     "end":"2021-05-31 23:59:59",
     "storeIds":[1257,1334,16698,32700,35002,3844,58048,59159,59642]}'

curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-18 00:00:00",
     "end":"2021-05-18 23:59:59",
     "storeIds":[51324]}'

curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-16 00:00:00",
     "end":"2021-05-18 23:59:59",
     "storeIds":[48087]}'

curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-16 00:00:00",
     "end":"2021-05-31 23:59:59",
     "storeIds":[23231,31525,47605,56656]}'

# 全部门店
curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-18 00:00:00",
     "end":"2021-05-18 23:59:59",
     "storeIds":[77777,50988,53685,48498,53518,53338,51226,50860,54562,49902,51344,48999,51224,52207,49531,51460,49815,50864,51947,49753,52102,50989,51480,49860,26183,50361,54183,48437,49754,29946,47006,54285,49000,49025,22251,22081,50917,51720,51946,27473,18052,31281,15616,47455,27017,48158,21826,14968,29779,53808,28083,51321,25640,26229,53890,16313,47507,29990,27901,31529,27660,51326,27666,49967,29109,18221,29030,24827,20565,48268,1383,25144,50013,35027,18486,51775,27076,32671,54485,49805,17176,29516,31457,29185,28825,53575,20610,22855,35061,31510,15904,19327,22338,22209,27661,53467,30672,21576,54193,31919,6120,35036,24745,49636,15400,21668,25485,47111,19328,53301,48942,26547,29029,29920,23231,49262,22024,49866,28084,48772,29329,27097,28820,3958,27279,25146,27987,48765,21246,21571,35046,16612,35031,48131,51806,1677,24124,23331,4148,49093,26686,31667,50180,32722,31293,48449,49878,26870,22849,54308,18167,29986,27244,18335,17558,35026,25734,24057,22217,25492,26077,22851,9178,35052,47067,49148,24901,53534,25313,20421,48607,1257,53958,24755,26389,48105,48087,24982,26542,20561,17451,27427,27665,48476,24723,23914,52644,25174,25167,26411,18825,27243,24129,20566,26869,27662,47465,28819,26543,27339,23533,28416,27208,23843,35002,22501,21114,52211,49309,24108,24980,26068,22744,22740,18741,16405,35008,20594,16698,29242,24119,31206,31351,48762,21838,24151,52222,27900,35032,51807,29515,18664,48188,51805,31935,23376,21112,27207,23766,50555,23219,27363,47533,24911,47066,23330,30623,16332,14969,18740,28001,54392,21926,51323,50333,23701,16630,48370,49970,21104,26312,35064,50796,17298,47425,25175,22850,50590,48783,48122,49149,29027,49015,23853,31776,17559,20911,30902,21666,53780,49097,16472,52571,31044,32334,17560,26416,52444,52215,27895,31525,54091,8185,24121,50286,53888,26124,50067,24116,18673,18932,19929,26541,21835,17047,32220,18333,51621,51318,49634,52472,53354,26017,18264,53028,26391,51748,51164,25145,35065,8097,48362,52303,18454,50984,49386,23684,22667,31063,24823,17168,25486,27240,51755,49032,47452,24229,31524,23546,21182,29919,49635,28709,29110,25561,17611,25900,23430,24211,32375,35049,29512,15464,26657,49779,30624,24378,24383,17715,29991,18339,47706,12731,35037,18222,48363,26412,28875,15191,16490,25495,52883,23040,26386,27834,19538,29577,22400,25792,19123,21629,48758,27275,20557,49458,15662,49740,1334,49402,54025,24122,53031,48580,50946,27206,52149,24722,49831,48815,35062,49770,31045,49096,29112,25727,15120,48791,25641,32235,19068,24120,3844,24341,23994,15048,28925,22072,27836,7034,22959,15401,48769,32700,31259,23746,25814,23326,31555,52456,22407,31636,52863,26611,16534,29318,49685,19928,24273,17758,25868,49744,22929,15312,49020,52862,47531,22694,18087,17705,48756,28164,22206,31933,31268,16631,24754,21830,19325,52689,6069,32516,52212,1355,8153,31715,27663,53292,48581,24979,18338,26548,23500,51347,48863,31850,51025,26414,27659,23327,48844,1774,47534,35014,31238,26417,49022,50503,17822,15499,50981,16965,47605,1663,26871,29807,18465,30800,49686,35050,16429,52214,32412,29987,26067,23382,35007,15205,51948,35010,25480,20614,53495,48221,18828,25899,15665,20132,18265,27098,20130,29108,18340,22509,29878,1652,35012,47221,52309,21116,50386,50725,32534,20564,31567,31463,35038,48237,49027,22672,25498,28823,30673,21412,25642,18266,27749,21718,27467,29998,30889,22146,51790,18428,23028,20599,24375,22148,35041,47212,50616,52882,22323,27209,18396,17592,13027,50147,16175,47450,19277,47216,48754,31509,35004,23717,25866,18337,1673,35005,24893,25723,30950,47211,15671,23928,32234,19077,49160,47545,27998,16024,1396,35029,1692,25901,32654,18931,29663,7198,23767,52776,49684,24421,53362,48774,23777,24335,18847,24749,47454,31365,21184,27466,15300,47614,32670,35011,23329,29802,25481,23768,21834,47707,47072,22937,50945,53355,18883,52657,8013,29922,52778,3493,29923,17790,22693,27748,27423,15119,51330,21665,17856,23437,48316,15202,49769,32624,49053,35006,26378,47215,25177,53904,22743,22777,49556,47424,31690,26758,18804,28421,27664,49235,51945,47711,22376,31811,32174,54045,19747,26413,35013,52445,16966,26544,52209,18482,23765,49687,48042,22510,26612,17155,25735,23774,32353,51034,20194,28961,55885,54422,54582,54899,49631,29691,53468,51324,54492,53364,52683,53794,51215,53686,52473,49836,52147,56048,27385,19265,20293,1639,22753,9060,18371,17676,16707,21308,18583,27867,22659,18161,17422,35803,31857,16170,31589,16308,24991,35813,18064,25926,35811,19215,48076,17162,29063,32415,16672,23488,32566,47173,22080,16357,28500,24347,4144,29065,17152,20776,8086,24699,31904,26139,32634,20988,48091,20794,29067,48104,31240,1648,29687,27383,29262,23796,21577,35809,19263,28989,20884,13179,17395,1336,19957,31730,20207,24834,17792,20190,23787,32337,35818,31903,32587,14908,32487,19407,35806,24546,20980,22061,27155,31134,3964,31239,22409,26728,31503,1491,48138,32336,35802,25749,18619,19016,1647,1378,32034,27387,24348,32093,16101,19567,29066,25872,31193,54049,56593,53233,55913,52786,52229,56199,54803,53843,54273,55195,55285,52693,56400,54322,51461,47619,55180,56328,55552,53363,52652,55963,52926,55842,56051,55523,56594,53360,56398,56963,56818,57097,56474,55250,50024,57115,23034,55553,52100,57254,56798,57674,57403,57485,56220,56968,48995,56291,55019,56404,51774,53400,56667,56618,55648,59042,54092,57553,57510,53692,58072,56739,58042,56740,58847,58569,99999,58357,57012,58286,55580,57105,57706,58907,58744,58457,59199,57552,51018,55925,59589,56770,59200,56434,54035,57231,48573,58459,58353,58663,58048,59210,58974,59740,59543,58583,59701,59051,59550,60077,59678,56656,60371,59455,59029,57676,59031,59706,60012,59642,59030,59159,59038,55674,57432,59549,59592,57850,58803,58636,58975,59643,59416,59766,57673,50456,57524,59626,57230,58977,59860,59776,60091,55926,59711,59544,60293,59744,59583,60381,60074,57404,58906,60703,60200,61048,60201,59957,58878,59741,58875,61221,60709,60810,60704,60471,60899,61286,58606,61351,59924,60520,61528,61289,54046,61772,61530,61078,61660,62001,62227,61809,61039,62477,62006,62264,62022,60114,60612,61794,60055,60348,62042,62855,63054,62234,60879,62252,61775,62630,59765,61088,62978,62609,62646,63478,63409,62482,63527,63200,61769,62110,62368,62449,63499,63662,61766,63557,60543,62979,61139,63513,63634,63528,63690,63666,63511,63322,62805,61803,61885,63641,61034,63290,63512,61991,63643,61765,61225,63642,63883,61148,63978,63829,54869,62483,62023,60100,63704,63343,61659,61695,62980,64658,60738,63827,64640,63799,63994,64846,63655,62097,64655,64621,64685,61480,64957,64710,64976,62103,64580,64737,63843,63810,64918,64749,65034,63515,65051,64739,64876,65331,65064,65013,65280,64959,65122,64961,64847,63968,63708,65315,65448,65257,65302,63058,63735,65256,65338,64998,64716,65673,65436,64977,65123,64717,63831,64812,62366,64774,64955,65258,65635,64860,65647,65939,66004,65500,66125,66075,65521,62059,65041,65596,64857,66074,66242,64996,65940,65339,65799,65988,65632,64753,58070,65597,66076,65579,66215,66441,65749,66342,66132,66630,65636,66491,65598,66247,66718,63294,65522,65797,66243,65261,66485,66211,66915,66926,65486]}'

# 部分门店
curl -X POST http://127.0.0.1:8080/starbucks/buy/batch \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-16 00:00:00",
     "end":"2021-05-31 23:59:59",
     "storeIds":[18052,31281,15616,27017,29779,51321,16313,51326,49967,1383,48268,27076,32671,29516,31457,53575,35061,15904,30672,54193,31919,21668,53301,29920,49262,22024,49866,27097,27279,27987,35046,16612,48131,1677,31667,32722,48449,54308,25492,26077,22851,49148,48607,25313,1257,17451,25167,25174,27243,28416,21114,24980,22744,18741,16405,20594,31206,31351,24151,35032,48188,51805,23376,50555,47533,14969,18740,50333,23701,47425,49015,31776,30902,52571,31044,31525,53888,18932,18673,32220,51318,49634,26017,8097,48362,50984,23684,49386,51755,21182,49635,17611,25900,23430,29512,35049,47706,18339,35037,48363,16490,22400,19123,27275,49458,24122,29112,19068,22072,15401,31259,23746,16534,19928,49744,15312,49020,18087,31933,17705,16631,52689,6069,1355,31715,23500,51347,27659,48844,1774,31850,31238,49022,15499,47605,30800,32412,26067,15205,51948,25480,48221,27098,18340,1652,32534,31567,35038,28823,30673,27749,18428,20599,22148,27209,18396,13027,23717,35004,35005,32234,19077,49160,35029,1692,32654,29663,7198,24749,47454,31365,32670,35011,47707,18883,53355,3493,17790,23437,35006,49556,47424,31690,27664,32174,16966,23765,48042,23774,28961,20194,55885,49631,19215,32566,22080,29065,29262,31730,20207,23787,32337,31903,32587,27155,31503,54322,56328,55250,55553,48995,55648,55580,56434,57231,59543,58583,59550,55674,57230,59626,55926,59957,60520,61289,54046,62264,63054,62482,63528,63690,61803,63290,61765,62483,60100,61659,64976,62103,64749,65034,63515,64847,63968,65635,65596]}'

# 根据订单号计算
curl -X POST http://127.0.0.1:8080/starbucks/buy/orders \
-H "Content-Type: application/json" \
-d '{"orderIds":[72057596502627221]}'

# 根据t_order_input
curl -X POST http://127.0.0.1:8080/starbucks/buy/input \
-H "Content-Type: application/json"


# 产能计算
curl -X GET http://localhost:8080/starbucks/store_capacity_avg


curl -X POST http://127.0.0.1:8080/starbucks/order_new?current=1\&size=10 \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-18 00:00:00",
     "end":"2021-05-18 23:59:59",
     "storeIds":[48087],
     "status":"SUCCESS"}'

curl -X POST http://127.0.0.1:8080/starbucks/order_new?current=1\&size=10 \
-H "Content-Type: application/json" \
-d '{"orderIds":[72057596500124197]}' | json

curl -X GET http://127.0.0.1:8080/starbucks/order_new_detail?id=72057596500124197 \
-H "Content-Type: application/json"

curl -X GET http://127.0.0.1:8080/starbucks/store_capacity?storeId=48087\&orderDate=2021-05-18 \
-H "Content-Type: application/json"

curl -X POST http://127.0.0.1:8080/starbucks/transaction_sale?current=1\&size=10 \
-H "Content-Type: application/json" \
-d '{"start":"2021-05-18 00:00:00",
     "end":"2021-05-18 23:59:59",
     "storeIds":[48087]}'

curl -X PUT "http://10.92.208.3:9200/store_geo_shape?pretty" \
-H 'Content-Type: application/json' \
-d '
{
  "mappings": {
    "_doc": {
      "properties": {
        "store_id": { "type": "keyword" },
        "location": { "type": "geo_shape"  }
      }
    }
  }
}'

curl -X POST 'http://10.92.208.3:9200/store_geo_shape/_doc' \
-H 'Content-Type: application/json' \
-d '
{
  "store_id": 1153,
  "location": {
    "type": "polygon",
    "coordinates": [
      [
        [120.62674, 30.002283, 	],
        [120.627029, 29.998774, ],
        [30.002283, 	120.62674]
      ]
    ]
  }
}'


curl 'http://10.92.208.3:9200/store_geo_shape' \
  -X 'DELETE' \
  -H 'Content-Type: application/json'


curl -X POST "http://10.92.208.3:9200/store_geo_shape/_search?pretty&filter_path=hits.total,hits.hits._source.store_id" -H 'Content-Type: application/json' -d'
{
  "size": 100,
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "geo_shape": {
          "location": {
            "shape": {
              "type": "point",
              "coordinates": [121.474756,31.215924]
            },
            "relation": "intersects"
          }
        }
      }
    }
  }
}
'

curl -X GET https://restapi.amap.com/v4/direction/bicycling?origin=116.33929505188,40.011157363344\&destination=116.45255341058,39.936401378723\&key=27b692db60ccbf7dd0a8d10b510c5682 \
-H 'Content-Type: application/json' > amap.json

nohup java -Xms4096m -Xmx4096m -jar -Dspring.profiles.active=test starbucks-0.0.1-SNAPSHOT.jar > /dev/null 2>&1 &
nohup java -Xms4096m -Xmx4096m -jar -Dspring.profiles.active=test starbucks-0.0.1-SNAPSHOT.jar > logs/starbucks.log 2>&1 &
cat logs/starbucks.log | grep 'Task start at' -A 5
cat logs/starbucks.log | grep 'Exception' -A 5
cat logs/starbucks.log | grep 'Task count' -A 5
tailf -n 100 logs/starbucks.log | grep 'Task count: '
tailf -n 100 logs/starbucks.log | grep 'Task running ->'
tailf -n 100 logs/starbucks.log | grep 'orderIds:  total:'
tailf -n 100 logs/starbucks.log | grep 'Exception'


nohup java -Xms4096m -Xmx4096m -jar \
-Dspring.profiles.active=test \
-Dbiz.scrowded.queue-switch=on \
starbucks-0.0.1-SNAPSHOT.jar > logs/starbucks.log 2>&1 &


nohup java -Xms4096m -Xmx4096m -jar \
-Dspring.profiles.active=test \
-Dbiz.scrowded.queue-insert-db-switch=off \
-Dbiz.global.stores_limit=off \
-Dbiz.scrowded.capacity-refer-to=off \
-Dbiz.satisfied.type=simple \
starbucks-0.0.1-SNAPSHOT.jar > logs/starbucks.log 2>&1 &